home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / videoutils / h-m / mandelsquare / mandelsquare.doc < prev    next >
Text File  |  1978-11-24  |  20KB  |  363 lines

  1. ========================== MandelSquare 1.6 ==========================
  2. ======================================================================
  3. Yet another Mandelbrot set exploration program written by Olaf `Olsen'
  4. Barthel.   ©  Copyright  1991  by  Olaf `Olsen' Barthel, Freeware, all
  5. rights reserved.
  6.    No guarantee of any kind is made that the program described in this
  7. document is 100% reliable.  You use this material on your own risk.
  8.  
  9. ========================= A word of warning ==========================
  10. ======================================================================
  11. `MandelSquare'  is  a  very `demanding' program which will run only on
  12. Amiga systems equipped with expensive custom hardware (i.e.  '881/'882
  13. accelerator boards, 68020/30/40 processors and real fast ram), a plain
  14. A3000(T/UX)  will do as well, but not quite as nicely as an A2000 with
  15. a  GVP  A3001 expansion board, an A3000(T/UX) fitted with an '040 card
  16. or an A4000.
  17.    Kickstart  2.04  (v37.175 or higher) and Workbench 2.1 or Workbench
  18. 3.0 are required to run this program.
  19.  
  20.                         YOU HAVE BEEN WARNED!
  21.  
  22. ============================= Background =============================
  23. ======================================================================
  24. I  have  been toying with this kind of program for a long time, I even
  25. started  writing  it  on  my  ol' faithful A500 back in 1990.  Since I
  26. don't  have  a  great  interest in mathematics (which currently causes
  27. `some'  problems  while  studying  computer  science  at university) I
  28. started this project to learn a bit about complex numbers and to shake
  29. off some of the trouble mentioned above.
  30.    The first internal revisions of this program would simply calculate
  31. pictures  dot by dot.  This technique while accurate and precise takes
  32. quite  a lot of time (see Thomas R.  Wilcox' `MSE').  There are faster
  33. ways   to   calculate   a  picture,  such  as  the  recursive  routine
  34. `MandelSquare'  uses:   the  screen is divided into four areas; if the
  35. pixels  in  the  four corners are of the same colour, the rectangle is
  36. filled  in  this  colour,  if  not,  the  area  is  divided  into four
  37. rectangles  and  the  same procedure is applied again.  This technique
  38. relies  on  the fact that the Mandelbrot set does not contain isolated
  39. points,  each  outline  rests  within a different outline, just like a
  40. matrioshka  puppet  is  contained in its mother puppet. `MandelSquare'
  41. uses  a  very  simple  form  of this algorithm which requires that the
  42. rectangles are square, and that's how the child received a name...
  43.    `MandelSquare'   uses  the  standard  z²+c  algorithm  to  generate
  44. pictures,  a  numerical  coprocessor  or an '040 is required since the
  45. calculation  is  done in a fast hand-coded '881/'882 assembly language
  46. subroutine.   While  throughout  the  whole  program  double precision
  47. values  (64  bits)  are  used  for calculation, the '881/'882 assembly
  48. language  subroutine  uses extended precision (96 bits) to do its job.
  49. While  I  can  and  will  not claim that `MandelSquare' is the fastest
  50. Mandelbrot  set  exploration program, I may say that it is the fastest
  51. program in respect to its accuracy and the algorithm employed.
  52.    Colours  are  assigned to pixels based on a linear transition table
  53. which  avoids the unpleasant look of broken colour ranges.  Transition
  54. tables  are  created  according  to  the  screen resolution (256/32/16
  55. colours).
  56.    Except  for  the  rectangle  filling  routines  `MandelSquare' uses
  57. custom  assembly  language  routines to do the picture rendering.  The
  58. program  still  tries to be very careful not to disturb system imagery
  59. such as the menu bar and the pull down menus.
  60.    The  screen  size  depends  on  the video overscan settings of your
  61. machine.   The following text assumes a resolution of 256 × 256 pixels
  62. (low resolution) and 512 × 512 pixels (high resolution).
  63.    In  late  August I played with the idea of adding animation support
  64. to  the  program, and here it is:  select the area you wish to zoom to
  65. and  `MandelSquare' will generate a standard Anim-Opt-5 animation file
  66. while  it  zooms  to  the  indicated  spot.  The animation file can be
  67. viewed  using  programs  such  as `ShowAnim', `DisplayAnim', `PPAnim',
  68. `Animagic', `The Director', `DPaint III/IV' and `MandelSquare' itself,
  69. of  course.  Many thanks to Gary Bonham and Jim Kent for releasing the
  70. anim  file  creation/delta  compression  and replay code to the public
  71. domain.
  72.    At        startup    time  `MandelSquare'  tries  to  read  a  file
  73. called  `MandelSquare.Title'    which    happens  to  be  the standard
  74. Mandelbrot  set  picture   where  all explorations will start.  If the
  75. named  file cannot be  found  the program will generate the picture it
  76. needs,  and  it  is  recommended  to  save  it  to disk under the name
  77. mentioned before.
  78.    Support  for  Kickstart  3.0 and the AGA chip set was added in late
  79. summer 1992, primarily to create an application to test the A4000.  As
  80. of  this  writing,  the  maximum  screen  depth  is  limited  to eight
  81. bitplanes,  which  yields 256 different colours.  The palette range is
  82. currently limited to eight bits per component (red, green, blue) which
  83. yields 16,777,216 distinct colours.  The screen size has to be exactly
  84. square  for  this program to work correctly.  If a monitor driver does
  85. not  support  this resolution, the corresponding display mode will not
  86. be included in the list to choose from.
  87.  
  88. ============================= The menus ==============================
  89. ======================================================================
  90. Following  is  a  description  of the functions and options associated
  91. with the pull down menus.
  92.  
  93. Open picture........... Opens   a  picture  file  in  IFF-ILBM  format
  94.                         created  by `MandelSquare', reads and displays
  95.                         it.   Since  coordinates, number of iterations
  96.                         and  screen  width  are saved with the picture
  97.                         you  may  continue  exploring  from  the point
  98.                         where  you  saved  it.
  99.  
  100. Save picture........... Saves  the current picture under the last name
  101.                         a  picture  file  was loaded.  If no file name
  102.                         was  loaded  yet,  you  will  be  prompted  to
  103.                         provide a file name.
  104.  
  105. Save picture as........ Saves  the  current  picture  under a name you
  106.                         have to provide.
  107.  
  108. Priority............... This  menu  allows  you  to  select  the  task
  109.                         priority `MandelSquare' will run under.  While
  110.                         0  is  the  standard  priority the majority of
  111.                         tasks  and  processes  will  execute  on  your
  112.                         machine  you  may want to change this value to
  113.                         -5  to  save  processing  time other tasks may
  114.                         wish   to   allocate   or   to   +5   to  make
  115.                         `MandelSquare'  allocate  more processing time
  116.                         than  possibly  available  when  running under
  117.                         priority 0.
  118.  
  119. Replay animation....... Will   load  and  replay  any  animation  file
  120.                         which meets the following conditions:
  121.  
  122.                         - Since  the replay routines do not open their
  123.                           own  display  (as  most  anim players do) it
  124.                           will   use   the  `MandelSquare' screen  for
  125.                           display.   This  means that any animation to
  126.                           be  replayed  must  be  recorded in the same
  127.                           resolution  (width,  height,  depth)  of the
  128.                           current screen.
  129.  
  130.                         - The  animation file must be compressed using
  131.                           delta mode 5.
  132.  
  133.                         - There  must  be  enough  memory available to
  134.                           load  the  animation  frames.  Any animation
  135.                           which  does  not  fit  into  memory  will be
  136.                           truncated.
  137.  
  138.                            If  successfully  loaded the animation will
  139.                         be  played repeatedly.  Press any key or mouse
  140.                         button to abort.
  141.  
  142. Begin animation........ After  providing  a  file  name  to  save  the
  143.                         animation  file  under  this  will  start  the
  144.                         animation  routine.   The  mouse  pointer will
  145.                         change  to  a crosshair allowing you to select
  146.                         the area to zoom to.  A requester will ask you
  147.                         to  confirm  the area size and positionm offer
  148.                         you  reselect  it (select `No' to do so) or to
  149.                         abort  the  animation  (select  `Abort').   If
  150.                         confirmed the animation will start.  It can be
  151.                         aborted at any time by selecting the menu `End
  152.                         Animation'.   After  the  animation  has  been
  153.                         rendered  you will again be presented with the
  154.                         crosshair   mouse   pointer   and   the  whole
  155.                         procedure starts again.  Should you decide not
  156.                         to  continue the animation just select a dummy
  157.                         area  and  click  on the `Abort' button of the
  158.                         confirmation requester.
  159.                            The   confirmation   requester   will  also
  160.                         display  the  number  of pictures to create in
  161.                         the  animation  when  zooming  to the selected
  162.                         spot.   This  value  is  based  on the current
  163.                         `Scroll Amount' settings (see below).
  164.  
  165. End animation.......... Selecting   this   menu  item  will  stop  any
  166.                         animation  creation  currently in progress and
  167.                         close the animation file without including the
  168.                         current picture.
  169.  
  170. Set scroll amount...... The  moves and zooms performed when generating
  171.                         animations  depend  largely  on  a magic value
  172.                         which can be adjusted when selecting this menu
  173.                         item.   The  `scroll amount' controls how many
  174.                         pixels  long  a  move or zoom may actually be.
  175.                         Any  distance  longer  than this value will be
  176.                         truncated   and   move/zoom   will  be  scaled
  177.                         approriately.   This  assures  that  moves and
  178.                         zooms will always execute at the same `speed'.
  179.                         (It  took  me  about  a month to discover this
  180.                         method of operation :-)
  181.  
  182. Include frame.......... When  zooming into an area `MandelSquare' will
  183.                         draw  a  square  around the area to zoom to if
  184.                         this   options   is  in  effect.   This  frame
  185.                         actually  shows  you where you are going to in
  186.                         the  Mandelbrot  set  and  may  remind  you of
  187.                         Charles   Eames'   famous   `Powers   of  Ten'
  188.                         film/slide show.
  189.  
  190. Include coordinates.... If  this  option  is in effect the coordinates
  191.                         and screen size of each picture to be added to
  192.                         an  animation  file  will  be printed into the
  193.                         lower  left  corner  of the image before it is
  194.                         saved.
  195.  
  196. Change resolution...... Selecting  this  menu  item  will  bring  up a
  197.                         screen  mode  requester to choose a new screen
  198.                         resolution.   Note  that  you  will  lose  the
  199.                         currently displayed picture if the screen mode
  200.                         is  changed.   `MandelSquare' will immediately
  201.                         start  recalculating  the  previous picture in
  202.                         the current resolution.
  203.  
  204. About.................. Shows a small `author' requester.
  205.  
  206. Quit................... Terminates the program.
  207.  
  208.  
  209. Magnify................ This  menu  item  lets  you  select an area on
  210.                         screen  using  the  mouse  `MandelSquare' will
  211.                         magnify   to   screen  size.   Note  that  the
  212.                         resolution   of   the   routines  employed  by
  213.                         `MandelSquare'  is limited and after a certain
  214.                         number    of   magnifications   the   pictures
  215.                         generated will look blurred or coarse, but the
  216.                         program  is  guaranteed to perform reliably up
  217.                         to     screen     resolutions     of     1E-13
  218.                         (0.0000000000001).
  219.  
  220. Detail................. If  changing  the  number  of iterations to be
  221.                         used for picture generation, the user may want
  222.                         to explore the new patterns and colours hidden
  223.                         inside the areas of the picture `MandelSquare'
  224.                         has  left  black.   `MandelSquare'  will check
  225.                         each  black  pixel  in  the  selected area and
  226.                         recalculate its colour.
  227.  
  228. Recalculate............ The algorithm employed by `MandelSquare' is by
  229.                         no  means  perfect:   it  will  sometimes fill
  230.                         rectangles  which  it  should not and truncate
  231.                         imagery.   This happens rarely enough, but the
  232.                         resulting   picture   can   be   corrected  by
  233.                         selecting  selecting  this  menu  item  and by
  234.                         marking  the  area  to  be recalculated.  Each
  235.                         pixel   of   the   selected   area   will   be
  236.                         recalculated and set accordingly.
  237.                            If  the  area  selected  is  as wide as the
  238.                         whole  screen  a  special mode will be used to
  239.                         render the pixels into fast ram.  As soon as a
  240.                         line  is  complete  it will be copied from the
  241.                         fast ram line buffer to the corresponding line
  242.                         on  screen.   This  is  especially  useful  if
  243.                         `MandelSquare'  is  running in high resolution
  244.                         mode  in  which  the  display  memory does not
  245.                         respond quite as fast as real fast memory.
  246.  
  247. Precise calculation.... If  this  option  is  in effect `MandelSquare'
  248.                         will  calculate  the  colours of all pixels on
  249.                         the  margins of a square which is to be filled
  250.                         in a single colour.  If these pixels all match
  251.                         the  same  colour the square will be filled as
  252.                         usual,  if not the square will be divided into
  253.                         four  smaller squares and the calculation will
  254.                         proceed.   While  this  method is more precise
  255.                         than  the  standard  way  it  avoids rendering
  256.                         errors   and   is   recommended  to  use  when
  257.                         generating   animations.   As  a  drawback  it
  258.                         is   slower   than   the  standard  method  of
  259.                         calculation.
  260.  
  261. Coordinates............ This  menu  item  will open a control panel in
  262.                         which  the  screen coordinates and size can be
  263.                         adjusted  manually  by  typing  the approriate
  264.                         floating point numbers.
  265.  
  266. Palette................ Selecting  this  menu item will open a palette
  267.                         control  panel  in  which three sliders are to
  268.                         shift  the  red/green/blue  colour  tables the
  269.                         screen  palette is made of.  Each colour table
  270.                         represents  the  positive  part of a sine wave
  271.                         spread  across  32/16 colors ranging from 0 to
  272.                         15.   Move  the sliders to create more or less
  273.                         interesting colour effects.
  274.  
  275. Toggle calculation..... Use  this  menu  item to abort any calculation
  276.                         currently  in  progress.  If no calculation is
  277.                         currently running, it will be restarted.
  278.  
  279.  
  280. 32-16384............... The  number  of  iterations  to  be  used when
  281.                         generating a picture.  The higher this number,
  282.                         the  longer  the calculation will take and the
  283.                         more  patterns  will  be revealed in otherwise
  284.                         black areas of the screen.
  285.  
  286. ============================ Special keys ============================
  287. ======================================================================
  288. Just  like  many  other  programs of this kind `MandelSquare' supports
  289. colour cycling.  The following keys control the cycling process:
  290.  
  291. Tab.................... Stops or restarts the colour cycling.
  292.  
  293. Cursor up.............. Starts the cycling in forward direction.
  294.  
  295. Cursor down............ Starts the cycling in reverse direction.
  296.  
  297. Cursor left............ Cycles the colour palette one entry backward.
  298.  
  299. Cursor right........... Cycles the colour palette one entry forward.
  300.  
  301. ========================== Author's request ==========================
  302. ======================================================================
  303. Since  I  don't  expect  Commodore  to sell more A3000(T/UX) and A4000
  304. machines,  GVP to sell more A3001 boards and PP&S, RCS and ACD to sell
  305. more  '040 cards just because I happened to create `MandelSquare' I am
  306. releasing  this  program and the accompanying source code as Freeware.
  307. The  program  may  not  be  sold  for  more than DM 5,- (3$ US) or the
  308. equivalent  in  the local country's currency, but it may be copied for
  309. free  as  long  as  my  copyright remains untouched.  If you like this
  310. program,  send  me copy of the animations or pictures you created with
  311. it, a picture postcard of your home town would be nice, too.
  312.  
  313.                       My `physical' address is:
  314.  
  315.                              Olaf Barthel
  316.                           Brabeckstrasse 35
  317.                           D-3000 Hannover 71
  318.  
  319.                      Federal Republic of Germany
  320.  
  321.                         My email adresses are:
  322.  
  323.                      Z-Net: O.BARTHEL@A-LINK-H
  324.                   Internet: olsen@sourcery.mxm.sub.org
  325.  
  326.    Comments  and suggestions how to improve this program are generally
  327. appreciated!
  328.  
  329. ============ Revision history (most recent change first) =============
  330. ======================================================================
  331. 1.6    Dropped  the  fancy  screen  wipes  for compatibility reasons,
  332.     rewrote  the IFF-ILBM and IFF-ANIM saving routines, also redid
  333.     the  animation replay routines, added support for the AGA chip
  334.     set,   Kickstart   and   Workbench   3.0   and  custom  screen
  335.     resolutions.   Following  the  advice  of Bernd Braun the main
  336.     calculation routine was rewritten for speed.
  337.  
  338. 1.5
  339. 1.4    Skipped
  340.  
  341. 1.3    Added  the  animation  replay  feature,  removed the crosshair
  342.     mouse  pointer, the colour transition tables are now generated
  343.     in  a  much  simpler  way  than before, some basic calculation
  344.     logics have been modified to permit faster execution.
  345.  
  346. 1.2    The  calculation  routine  was slightly rewritten to allow for
  347.     earlier  termination  (old  code  used  to go through the more
  348.     complicated  calculations before actually noticing that it was
  349.     time  to  terminate).   The  `precise' calculation code should
  350.     work  much  faster  now  since  the  precalculation  will  now
  351.     terminate  as  soon  as  an  odd  pixel  is  encountered.  The
  352.     animation  code  now  sports  much smoother camera zooms.  Old
  353.     code  used  to  bounce  & accelerate when coming closer to the
  354.     selected  square,  the new code will always appear to approach
  355.     the  square at the same speed.  The zoom speed may be set to a
  356.     custom  value  and  the  zoom  code actually precalculates the
  357.     number  of  frames  to  calculate before reaching the selected
  358.     square.  I also added an option to have a box displayed around
  359.     the  selected  square  whilst rendering the single frames (for
  360.     the `Powers of Ten' effect).
  361.  
  362. 1.1    First public release.
  363.